/*
 * Created by SharpDevelop.
 * User: rseward
 * Date: 7/4/2008
 * Time: 11:09 AM
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */

using System;
using System.IO;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;

using AvvaMobileNHibernateHelperKit;
using AvvaMobileNHibernateHelperKit.DAO;

namespace TestNHibernateHelperKit
{
	[TestFixture]
	public class TestProjectDao
	{
		[Test]
		public void TestMeds()
		{
			ProjectDao dao = ProjectDao.Instance;
			
			MedsProject project = new MedsProject();
			
			project.ProjectFile = "meds.xml";
			
			dao.SaveProject(project);
			
			FileInfo projFile = new FileInfo( project.ProjectFile );
			
			Console.WriteLine("Should have written MEDS project to: {0}", projFile.FullName);
			Assert.IsTrue( projFile.Exists , "Unable to find the project file" );
			
			Project savedp = dao.GetProject(projFile.FullName);
			
			Assert.IsNotNull( savedp );
			Assert.AreEqual( project.AssemblyName, savedp.AssemblyName);
			Assert.AreEqual( project.DatabaseName, savedp.DatabaseName);
			Assert.AreEqual( project.Namespace, savedp.Namespace);
			Assert.AreEqual( project.Password, savedp.Password);
			Assert.AreEqual( project.ProjectDir, savedp.ProjectDir);
			Assert.AreEqual( project.ServerName, savedp.ServerName);
			Assert.AreEqual( project.Username, savedp.Username);
			Assert.AreEqual( project.SelectedTables.Length, savedp.SelectedTables.Length);
			
			
		}
		
		
		
	}
}
